package com.ujiuye.dao;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.ujiuye.entity.User1;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class User1Dao {
        ComboPooledDataSource  dataSource = new ComboPooledDataSource();
        QueryRunner qr = new QueryRunner(dataSource);
    public int SaveUser1(User1 user1) {
        String sql = "insert into user1 values (null,?,?,?,?,?,?)";
        try {
            return qr.update(sql,user1.getUsername(),user1.getPassword(),user1.getName(),user1.getSex(),user1.getHobby(),user1.getSdesc() );
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return 0;
    }
}
